package com.norra.client.ui

import android.os.Bundle
import android.util.Log
import android.view.MotionEvent
import android.view.View
import android.widget.CompoundButton
import android.widget.Switch
import com.norra.client.R

class TestSwitch : BaseActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_switch)

        val switch = findViewById<Switch>(R.id.switch_me)

        switch.setOnClickListener(object:View.OnClickListener{
            override fun onClick(v: View?) {
                Log.d("xxx", "On click")
            }
        })

        switch.setOnCheckedChangeListener(object:CompoundButton.OnCheckedChangeListener{
            override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
                Log.d("xxx", "On check changed:" + isChecked)
            }

        })

        switch.setOnTouchListener(object:View.OnTouchListener{
            override fun onTouch(v: View?, event: MotionEvent?): Boolean {
                Log.d("xxx", "On touch:" + event?.actionMasked)
                return true
            }

        })
    }
}